import { request } from "@ruifox-cms/utils";

// 校验表单
export function checkForm(data) {
  return request({
    url: "/form/api/paper/checkForm",
    method: "post",
    data,
  });
}

// 获取表单数据
export function getFormData(params) {
  return request({
    // baseURL: '/form_api',
    url: "/form/api/paper/getCurFormInfo",
    method: "get",
    params,
  });
}
//查询表单
export function selectPaper(params) {
  return request({
    // baseURL: '/form_api',
    url: "/form/api/paper/select",
    method: "get",
    params,
  });
}
//分页查询表单
export function selectPagePaper(params) {
  return request({
    // baseURL: '/form_api',
    url: "/form/api/paper/selectPage",
    method: "get",
    params,
  });
}
//查询答卷
export function selectPaperResult(params) {
  return request({
    // baseURL: '/form_api',
    url: "/form/api/paperResult/select",
    method: "get",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded", // 设置请求头
    },
    params,
  });
}
// 提交表单
export function insertPaperResult(data) {
  return request({
    url: "/form/api/paperResult/insert",
    method: "post",
    data,
  });
}

// 填写记录(自己的)
export function selectPaperResultList(params) {
  return request({
    url: "/form/api/paperResult/selectList",
    method: "get",
    params,
  });
}
// 获取表单答卷详情
export function getAnswerDetail(params) {
  return request({
    // baseURL: process.env.NODE_ENV == "development" ? "/form_api" : "/api",
    url: "/form/api/paperResult/select",
    method: "get",
    params,
  });
}
// 查询所有题目分组(以树形结构返回)
export function selectAllQuestionByTreePaperBank(params) {
  return request({
    baseURL: '/form_api',
    url: "/form/api/paperBank/selectAllQuestionByTree",
    method: "get",
    params,
  });
}
//根据分组分页查询题目
export function selectBankQuestionPagePaperBank(params) {
  return request({
    baseURL: '/form_api',
    url: "/form/api/paperBank/selectBankQuestionPage",
    method: "get",
    params,
  });
}
//根据id查询题目
export function selectByIdPaperQuestion(params) {
  return request({
    baseURL: '/form_api',
    url: "/form/api/paperQuestion/selectById",
    method: "get",
    params,
  });
}